From bdf87ba0f8a1d6ca985097c8245bda50e70a87b6 Mon Sep 17 00:00:00 2001 From: t895 Date: Wed, 3 Jan 2024 17:57:20 -0500 Subject: frontend_common: config: Move WriteIntegerSetting definition to header Fixes a compiler error where the compiler could not see the definition of the method in qt_config and others. --- src/frontend_common/config.cpp | 11 ----------- src/frontend_common/config.h | 16 +++++++++++----- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/src/frontend_common/config.cpp b/src/frontend_common/config.cpp index 51576b4ee..359a0d267 100644 --- a/src/frontend_common/config.cpp +++ b/src/frontend_common/config.cpp @@ -762,17 +762,6 @@ void Config::WriteBooleanSetting(const std::string& key, const bool& value, WritePreparedSetting(key, AdjustOutputString(ToString(value)), string_default, use_global); } -template -std::enable_if_t> Config::WriteIntegerSetting( - const std::string& key, const T& value, const std::optional& default_value, - const std::optional& use_global) { - std::optional string_default = std::nullopt; - if (default_value.has_value()) { - string_default = std::make_optional(ToString(default_value.value())); - } - WritePreparedSetting(key, AdjustOutputString(ToString(value)), string_default, use_global); -} - void Config::WriteDoubleSetting(const std::string& key, const double& value, const std::optional& default_value, const std::optional& use_global) { diff --git a/src/frontend_common/config.h b/src/frontend_common/config.h index 0c4d505b8..b01631649 100644 --- a/src/frontend_common/config.h +++ b/src/frontend_common/config.h @@ -157,17 +157,23 @@ protected: void WriteBooleanSetting(const std::string& key, const bool& value, const std::optional& default_value = std::nullopt, const std::optional& use_global = std::nullopt); - template - std::enable_if_t> WriteIntegerSetting( - const std::string& key, const T& value, - const std::optional& default_value = std::nullopt, - const std::optional& use_global = std::nullopt); void WriteDoubleSetting(const std::string& key, const double& value, const std::optional& default_value = std::nullopt, const std::optional& use_global = std::nullopt); void WriteStringSetting(const std::string& key, const std::string& value, const std::optional& default_value = std::nullopt, const std::optional& use_global = std::nullopt); + template + std::enable_if_t> WriteIntegerSetting( + const std::string& key, const T& value, + const std::optional& default_value = std::nullopt, + const std::optional& use_global = std::nullopt) { + std::optional string_default = std::nullopt; + if (default_value.has_value()) { + string_default = std::make_optional(ToString(default_value.value())); + } + WritePreparedSetting(key, AdjustOutputString(ToString(value)), string_default, use_global); + } void ReadCategory(Settings::Category category); void WriteCategory(Settings::Category category); -- cgit v1.2.3